package com.fare.taluo.vo.core;

import java.text.ParseException;
import java.util.Date;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.time.DateUtils;

//抓取渠道
public class ChannelPlaneinfo {
	//代理人名称
	private String agentName = "";
	//抓取渠道全称
		private String carrierFullName = "";
		
		//抓取地缩写
		private String carrierKey = "";
		
		//抓取渠道简写
		private String carrierName = "";
		
		//航班批次号
		private String flightBatch = "";
		
		//批次日期
		private String flightBatchDate = "";
		
		//批次结束时间
		private String flightBatchEndTime = "";
		
		//批次开始时间
		private String flightBatchStartTime = "";
		
		//起飞编号
		private String flightId = "";
		
		//起飞城市三字码
		private String fromCity = "";
		
		//起飞城市名
		private String fromCityName = "";
		
		//抓取渠道
		private String grabChannel = "";
		
		//抓取日期
		private String grabDate = "";
		
		//最高价
		private String  highPrice = "";
		
		//最低价
		private String lowprPrice = "";
		
		//达到城市三字码
		private String toCity = "";
		
		//达到城市名称
		private String toCityName = "";
		
		//飞机型号
		private String type = "";
	public String getAgentName() {
		return agentName;
	}

	public void setAgentName(String agentName) {
		this.agentName = agentName;
	}

	public String getCarrierFullName() {
		return carrierFullName;
	}

	public void setCarrierFullName(String carrierFullName) {
		this.carrierFullName = carrierFullName;
	}

	public String getCarrierKey() {
		return carrierKey;
	}

	public void setCarrierKey(String carrierKey) {
		this.carrierKey = carrierKey;
	}

	public String getCarrierName() {
		return carrierName;
	}

	public void setCarrierName(String carrierName) {
		this.carrierName = carrierName;
	}

	public String getFlightBatch() {
		return flightBatch;
	}

	public void setFlightBatch(String flightBatch) {
		this.flightBatch = flightBatch;
	}

	public String getFlightBatchDate() {
		return flightBatchDate;
	}

	public void setFlightBatchDate(String flightBatchDate) {
		this.flightBatchDate = flightBatchDate;
	}

	/*public String getFlightBatchEndTime() {
		return flightBatchEndTime;
	}*/

	public String getFlightBatchEndTime() {
		if(flightBatchEndTime.indexOf(":")>0){
			return flightBatchEndTime;
		}else{
			return flightBatchEndTime.substring(0,2)+":"+flightBatchEndTime.substring(2,flightBatchEndTime.length());
		}
	}
	public void setFlightBatchEndTime(String flightBatchEndTime) {
		this.flightBatchEndTime = flightBatchEndTime;
	}

/*	public String getFlightBatchStartTime() {
		return flightBatchStartTime;
	}*/

	public String getFlightBatchStartTime() {
		if(flightBatchStartTime.indexOf(":")>0){
			return flightBatchStartTime;
		}else{
			return flightBatchStartTime.substring(0,2)+":"+flightBatchStartTime.substring(2,flightBatchStartTime.length());
		}
	}
	public void setFlightBatchStartTime(String flightBatchStartTime) {
		this.flightBatchStartTime = flightBatchStartTime;
	}

	public String getFlightId() {
		return flightId;
	}

	public void setFlightId(String flightId) {
		this.flightId = flightId;
	}

	public String getFromCity() {
		return fromCity;
	}

	public void setFromCity(String fromCity) {
		this.fromCity = fromCity;
	}

	public String getFromCityName() {
		return fromCityName;
	}

	public void setFromCityName(String fromCityName) {
		this.fromCityName = fromCityName;
	}

	public String getGrabChannel() {
		return grabChannel;
	}

	public void setGrabChannel(String grabChannel) {
		this.grabChannel = grabChannel;
	}

	public String getGrabDate() {
		return grabDate;
	}

	public void setGrabDate(String grabDate) {
		this.grabDate = grabDate;
	}

	public String getHighPrice() {
		return highPrice;
	}

	public void setHighPrice(String highPrice) {
		this.highPrice = highPrice;
	}

	public String getLowprPrice() {
		return lowprPrice.indexOf(".")>0 ? lowprPrice.substring(0,lowprPrice.indexOf(".")) : lowprPrice ;
	}
	/*public Long getLowprPrice() {
		return lowprPrice;
	}
*/
	public void setLowprPrice(String lowprPrice) {
		this.lowprPrice = lowprPrice;
	}

	public String getToCity() {
		return toCity;
	}

	public void setToCity(String toCity) {
		this.toCity = toCity;
	}

	public String getToCityName() {
		return toCityName;
	}

	public void setToCityName(String toCityName) {
		this.toCityName = toCityName;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	//得到起飞时间
	public Date getFlightStartTime() throws ParseException{
		if(StringUtils.isNotEmpty(flightBatchDate) && StringUtils.isNotEmpty(flightBatchStartTime)){
			String time = flightBatchStartTime.indexOf(":") > -1 ? flightBatchStartTime.replace(":", "") : flightBatchStartTime;
			if(time.length() == 3)  time = "0"+time;
			else if(time.length() == 2) time = "00"+time;
			else if(time.length() == 1) time = "000"+time;
			return DateUtils.parseDate(flightBatchDate+" "+time, "yyyy-MM-dd HHmm");
		}
		return null;
	}
	
	public Date getFlightEndTime() throws ParseException{
		if(StringUtils.isNotEmpty(flightBatchDate) && StringUtils.isNotEmpty(flightBatchEndTime)){
			String time = flightBatchEndTime.indexOf(":") > -1 ? flightBatchEndTime.replace(":", "") : flightBatchEndTime;
			if(time.length() == 3)  time = "0"+time;
			else if(time.length() == 2) time = "00"+time;
			else if(time.length() == 1) time = "000"+time;
			return DateUtils.parseDate(flightBatchDate+" "+time, "yyyy-MM-dd HHmm");
		}
		return null;
	}
}
